﻿using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Configuration;
using System.Windows.Forms;
using System.Xml;
using MiniCrawler.Business;
using MiniCrawler.Form;
using MiniCrawler.Logging;

namespace MiniCrawler
{

    class Program
    {
        #region Method Main

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        ///// <summary>
        ///// Method Main
        ///// </summary>
        ///// <param name="args"></param>
        //static void Main(string[] args)
        //{
 
        //    LogService.Service.Info("Bat dau crawler data: " + DateTime.Now.ToString());

        //    Log.WriteCurrentLog("START CRAWLING FROM " + Constant.URL.NewsVCA);

        //    Log.WriteCurrentLog("CRAWLING STATE " + ConfigurationManager.AppSettings["RunningState"]);

        //    string usernametoasoan = Config.GetValueByKey(Constant.AppSettingKeys.ACOUNTTOASOAN);

        //    Log.WriteLog("Account toa soan " + usernametoasoan);

        //    string passwordtoasoan = Config.GetValueByKey(Constant.AppSettingKeys.PASSTOASOAN);

        //    Log.WriteLog("Pass toa soan " + passwordtoasoan);

        //    string toasoanlocation = Config.GetValueByKey(Constant.AppSettingKeys.TOASOAN_LOCATION);

        //    Log.WriteLog("Location toa soan " + toasoanlocation);

        //    string urltoasoan = Config.GetValueByKey(Constant.AppSettingKeys.URLTOASOAN);

        //    Log.WriteLog("Url toa soan " + urltoasoan);


        //    if (toasoanlocation.Contains(Constant.Location.INTERNET))
        //    {
        //        if (!WebServices.IsAuthenticated(usernametoasoan, passwordtoasoan))
        //        {
        //            LogService.Service.Error("invalid authentication bao dien tu");
        //            return;
        //        }   
        //    }

        //    var x = new LinkCollector(2);
        //    x.Run();

        //    Log.WriteLog("[STOP---------------------------------------]");

        //    LogService.Service.Info("Ket thuc crawler data: " + DateTime.Now.ToString());
        //    LogService.Service.Info("--------------------------------------------------");
        //    Console.ReadLine();
        //    Environment.Exit(0);
        //}



        #endregion       
    }
}
